home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / infoplus.zip / PAGE_16.INC < prev    next >
Text File  |  1990-06-25  |  6KB  |  194 lines

  1. procedure page_16;
  2.  
  3. var
  4.   bootrec : array[0..secsiz - 1] of byte;
  5.   i : 1..26;
  6.   j : word;
  7.   l : longint;
  8.   xbool : boolean;
  9.   xbyte : byte;
  10.   xchar : char;
  11.   xword1 : word;
  12.   xword2 : word;
  13.   xword3 : word;
  14.   xword4 : word;
  15.   xword5 : word;
  16.  
  17. begin
  18.   window(1, 3, twidth div 2, tlength - 2);
  19.   caption1('Boot record of ');
  20.   drvname(currdrv);
  21.   writeln;
  22.   xword1:=diskread(currdrv, 0, 1, bootrec);
  23.   if xword1 = $0000 then begin
  24.     media(bootrec[$15], bootrec[$0D]);
  25.     caption3('Sectors/cluster');
  26.     writeln(bootrec[$0D]);
  27.     caption3('Bytes/sector');
  28.     writeln(cbw(bootrec[$0B], bootrec[$0C]));
  29.     caption3('Reserved sectors');
  30.     writeln(cbw(bootrec[$0E], bootrec[$0F]));
  31.     caption3('FAT''s');
  32.     writeln(bootrec[$10]);
  33.     caption3('Sectors/FAT');
  34.     writeln(cbw(bootrec[$16], bootrec[$17]));
  35.     caption3('Root directory entries');
  36.     writeln(cbw(bootrec[$11], bootrec[$12]));
  37.     writeln;
  38.     caption3('Heads');
  39.     writeln(cbw(bootrec[$1A], bootrec[$1B]));
  40.     caption3('Total sectors');
  41.     xword1:=bootrec[$13] + word(bootrec[$14] shl 8);
  42.     if xword1 = 0 then
  43.       begin
  44.       l:=bootrec[$20] + (bootrec[$21] * $100) +
  45.         (bootrec[$22] * $10000) + (bootrec[$23] * $1000000);
  46.       Writeln(l)
  47.       end
  48.     else
  49.       writeln(cbw(bootrec[$13], bootrec[$14]));
  50.     caption3('Sectors/track');
  51.     writeln(cbw(bootrec[$18], bootrec[$17]));
  52.     caption3('Hidden sectors');
  53.     if xword1 = 0 then
  54.       begin
  55.       l:=bootrec[$1C] + (bootrec[$1D] * $100) +
  56.         (bootrec[$1E] * $10000) + (bootrec[$1F] * $1000000);
  57.       Writeln(l)
  58.       end
  59.     else
  60.       writeln(cbw(bootrec[$1C], bootrec[$1D]));
  61.     caption3('OEM name and version');
  62.     for i:=$03 to $0A do
  63.       write(showchar(chr(bootrec[i])));
  64.     writeln;
  65.     if (osmajor >= 4) and (bootrec[$26] = $29) then
  66.       begin
  67.       caption3('Volume label');
  68.       for j:=$2B to $35 do
  69.         Write(showchar(Chr(bootrec[j])));
  70.       Writeln;
  71.       caption3('Serial Number');
  72.       Writeln(hex(cbw(bootrec[$29], bootrec[$2A]), 4), '-',
  73.         hex(cbw(bootrec[$27], bootrec[$28]), 4));
  74.       caption3('FAT type');
  75.       for j:=$36 to $3D do
  76.         Write(showchar(Chr(bootrec[j])))
  77.       end
  78.   end else begin
  79.     writeln('  Can''t read boot record');
  80.     write('  ');
  81.     xbyte:=hi(xword1);
  82.     case xbyte of
  83.       $80 : writeln('Attachment failed to respond');
  84.       $40 : writeln('Seek operation failed');
  85.       $20 : writeln('Controller failed');
  86.       $10 : writeln('Data error (bad CRC)');
  87.       $08 : writeln('DMA failure');
  88.       $04 : writeln('Sector not found');
  89.       $03 : writeln('Write-protect fault');
  90.       $02 : writeln('Bad address mark');
  91.       $01 : writeln('Bad command');
  92.       $00 : writeln
  93.       else
  94.         unknown('error', xbyte, 2)
  95.     end;
  96.     write('  ');
  97.     xbyte:=lo(xword1);
  98.     case xbyte of
  99.       $00 : writeln('Write-protect error');
  100.       $01 : writeln('Unknown unit');
  101.       $02 : writeln('Drive not ready');
  102.       $03 : writeln('Unknown command');
  103.       $04 : writeln('Data error (bad CRC)');
  104.       $05 : writeln('Bad request structure length');
  105.       $06 : writeln('Seek error');
  106.       $07 : writeln('Unknown media type');
  107.       $08 : writeln('Sector not found');
  108.       $09 : writeln('Printer out of paper');
  109.       $0A : writeln('Write fault');
  110.       $0B : writeln('Read fault');
  111.       $0C : writeln('General failure')
  112.       else
  113.         unknown('error', xbyte, 2)
  114.     end
  115.   end;
  116.   window(1 + twidth div 2, 3, twidth, tlength - 2);
  117.   i:=1;
  118.   xbool:=false;
  119.   xword1:=memw[devseg : devofs + $0018];
  120.   xword2:=memw[devseg : devofs + $0016];
  121.   repeat
  122.     if osmajor >= 4 then
  123.       xbyte:=1
  124.     else
  125.       xbyte:=0;
  126.     caption1('DOS disk parameter block for ');
  127.     drvname(i - 1);
  128.     writeln;
  129.     xword3:=memw[xword1 : xword2 + $0047];
  130.     xword4:=memw[xword1 : xword2 + $0045];
  131.     media(mem[xword3 : xword4 + $0016 + xbyte],
  132.           mem[xword3 : xword4 + $0004] + 1);
  133.     caption3('Sectors/cluster');
  134.     writeln(mem[xword3 : xword4 + $0004] + 1);
  135.     caption3('Bytes/sector');
  136.     writeln(memw[xword3 : xword4 + $0002]);
  137.     caption3('Reserved sectors');
  138.     writeln(memw[xword3 : xword4 + $0006]);
  139.     caption3('FAT''s');
  140.     writeln(mem[xword3 : xword4 + $0008]);
  141.     caption3('Sectors/FAT');
  142.     if osmajor >= 4 then
  143.       Writeln(Mem[xword3:xword4 + $000F] +
  144.           (Mem[xword3:xword4 + $0010] * 256))
  145.     else
  146.       writeln(mem[xword3 : xword4 + $000F]);
  147.     caption3('Root directory entries');
  148.     writeln(memw[xword3 : xword4 + $0009]);
  149.     writeln;
  150.     caption3('DPB valid');
  151.     yesorno(mem[xword3 : xword4 + $0017 + xbyte] < $FF);
  152.     caption3('Current directory');
  153.     j:=xword2;
  154.     xchar:=chr(mem[xword1 : j]);
  155.     while xchar > #0 do begin
  156.       write(xchar);
  157.       inc(j);
  158.       xchar:=chr(mem[xword1 : j])
  159.     end;
  160.     writeln;
  161.     caption3('Device header');
  162.     segofs(memw[xword3 : xword4 + $0014 + xbyte],
  163.       memw[xword3 : xword4 + $0012 + xbyte]);
  164.     writeln;
  165.     caption3('Unit within driver');
  166.     writeln(mem[xword3 : xword4 + $0001]);
  167.     caption3('Clusters');
  168.     writeln(memw[xword3 : xword4 + $000D] - 1);
  169.     caption3('Cluster to sector shift');
  170.     writeln(mem[xword3 : xword4 + $0005]);
  171.     caption3('Root directory sector');
  172.     writeln(memw[xword3 : xword4 + $0010 + xbyte]);
  173.     caption3('First data sector');
  174.     writeln(memw[xword3 : xword4 + $000B]);
  175.     caption3('Next DPB');
  176.     xword5:=memw[xword3 : xword4 + $0018 + xbyte];
  177.     segofs(memw[xword3 : xword4 + $001A + xbyte], xword5);
  178.     writeln;
  179.     if (i < lastdrv) and (xword5 < $FFFF) then begin
  180.       write('  ');
  181.       pause1;
  182.       if endit then
  183.         Exit;
  184.       clrscr;
  185.       inc(i);
  186.       if osmajor >= 4 then
  187.         Inc(xword2, $58)
  188.       else
  189.         inc(xword2, $51)
  190.     end else
  191.       xbool:=true
  192.   until xbool
  193. end;
  194.